<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="container">
        <div class="box active">
            <div class="box2 active"></div>
            <ul>
                <li class="boxactive">第一个</li>
                <li class="active">第二个</li>
            </ul>
            <span>
                    <span class="active title"></span>
            </span>
        </div>
    </div>
    <script>
            let containerEle = document.querySelector(".container");  
            let eles = containerEle.querySelectorAll("*");
            // console.log(eles);
            eles.forEach( ele => {
                let str = ele.className ; 
                let reg = /\bactive\b/g ;
                if ( reg.test(str) ){
                    console.log(ele);
                }
            });
    </script>
</body>
</html>